package pteam;
public class Node {
  public static int nextId = 0;
  public int id = nextId++;

  public Link south, north, east, west;
  
  public void Node() {}
  
  public Link get(int i) {
  Link[] t = {north, east, south, west};
    return t[i];
  }
  
  public void set(int i, Link l) {
    if(i == Tree.NORTH) north = l;
    if(i == Tree.SOUTH) south = l;
    if(i == Tree.EAST) east = l;
    if(i == Tree.WEST) west = l;
  }
  
  public String toString() {
    return "==== id = " + id + " ====\n" +
           "N " + Tree.NORTH + " " + north + "\n" +
           "S " + Tree.SOUTH + " " + south + "\n" +
           "E " + Tree.EAST  + " " + east  + "\n" +
           "W " + Tree.WEST  + " " + west  + "\n";
  }
}